#!/usr/bin/env python3
# 
# cp path_to_formulas4TE/README.md note.readme
# 
# e.g.:
# 
# cp ../../github/formulas4TE/README.md note.readme
#

file_orig = 'note.readme'
file_now = 'README.md'

exclude = ['block::end::howto']

inSect = False
datas2 = []
with open(file_orig, 'r') as f:
    for line in f:
        if line.startswith('## 附录'):
            inSect = True
        if inSect:
            if not any([ ( item in line ) for item in exclude ]):
                datas2.append(line)

datas2[0] = '## 如何在 MicroSoft Office 中使用网页上的公式\n'
datas2[2] = '> **原网站:** [https://github.com/JianboHIT/formulas4TE](https://github.com/JianboHIT/formulas4TE)\n'

with open(file_now, 'w') as f:
    f.writelines(datas2)
